import Vue from 'vue'
import VueRouter from 'vue-router'
import editor from './editor'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
    meta: {
      title: '登录',
    },
  },
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/Home.vue'),
    meta: {
      title: '首页',
    },

    redirect: '/home',
    children: [
      {
        path: 'home',
        name: 'PageHome',
        component: () => import('../views/home/HomePage.vue'),
        meta: {
          title: '首页',
        },
      },

      {
        path: 'article-detail',
        name: 'ArticleDetail',
        component: () => import('../views/home/ArticleDetail.vue'),
        meta: {
          title: '文章详情',
        },
      },
    ],
  },
  {
    path: '/todolist',
    name: 'TodoList',
    component: () => import('../views/todo-list/Index.vue'),
    meta: {
      title: '代办列表',
    },
  },
  ...editor, //富文本编辑
  // {
  //   path: "/about",
  //   name: "About",
  //   route level code-splitting
  //   this generates a separate chunk (about.[hash].js) for this route
  //   which is lazy-loaded when the route is visited.
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/About.vue"),
  // },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes,
})

export default router
